import grpc
from pydantic import BaseModel, Field

class RpcStubConfig(BaseModel):
    endpoint: str = Field(alias="Endpoint")
    
def new_rpc_stub(config: RpcStubConfig, stub_cls: type, *, options=None):
    channel = grpc.insecure_channel(config.endpoint, options=options)
    return stub_cls(channel)